**# Bookmark #1 Setting

*Windows
global root  = "G:/Dropbox/Environmental Injustice/Empirical"
global rawdata = "$root/rawdata"
global workdata = "$root/workdata"
global results = "$root/results"
global outfile = "$root/outfile"

cd "$workdata"


**# Bookmark #2 Controlling for the Water Pollution Prevention and Control Plan for Major River Basins
use "$outfile/Table S7 Column 1",clear

reghdfe codemission c.belowcl##i.post i.Riverpolicy##i.riverpost,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",replace ctitle("City-level COD Emission") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 2",clear

reghdfe codemission c.belowcl##i.post i.Riverpolicy##i.riverpost,absorb(i.id i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm-level COD Emission") ///
keep(1.post#c.belowcl) ///
addtext(City FE, NO, Firm FE, YES, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 3",clear

reghdfe entrynum c.belowcl##i.post i.Riverpolicy##i.riverpost,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm Entry") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 4",clear

reghdfe exitnum c.belowcl##i.post i.Riverpolicy##i.riverpost,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm Exit") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

**# Bookmark #3 Controlling for the River Chief Policy
use "$outfile/Table S7 Column 1",clear

reghdfe codemission c.belowcl##i.post RCP,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("City-level COD Emission") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 2",clear

reghdfe codemission c.belowcl##i.post RCP,absorb(i.id i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm-level COD Emission") ///
keep(1.post#c.belowcl) ///
addtext(City FE, NO, Firm FE, YES, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 3",clear

reghdfe entrynum c.belowcl##i.post RCP,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm Entry") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 4",clear

reghdfe exitnum c.belowcl##i.post RCP,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm Exit") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

**# Bookmark #4 Controlling for the Release of the List of National Key Monitoring Firms
use "$outfile/Table S7 Column 1",clear

reghdfe codemission c.belowcl##i.post list,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("City-level COD Emission") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 2",clear

reghdfe codemission c.belowcl##i.post listpost,absorb(i.id i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm-level COD Emission") ///
keep(1.post#c.belowcl) ///
addtext(City FE, NO, Firm FE, YES, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 3",clear

reghdfe entrynum c.belowcl##i.post list,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm Entry") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 4",clear

reghdfe exitnum c.belowcl##i.post list,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm Exit") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

**# Bookmark #5 Drop Samples Selected by the Water Pollution Prevention and Control Plan
use "$outfile/Table S7 Column 1",clear

gen select=Riverpolicy*riverpost

reghdfe codemission c.belowcl##i.post if select==0,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("City-level COD Emission") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 2",clear

gen select=Riverpolicy*riverpost

reghdfe codemission c.belowcl##i.post if select==0,absorb(i.id i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm-level COD Emission") ///
keep(1.post#c.belowcl) ///
addtext(City FE, NO, Firm FE, YES, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 3",clear

gen select=Riverpolicy*riverpost

reghdfe entrynum c.belowcl##i.post if select==0,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm Entry") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 4",clear

gen select=Riverpolicy*riverpost

reghdfe exitnum c.belowcl##i.post if select==0,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm Exit") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

**# Bookmark #6 Drop Samples Selected by the River Chief Policy
use "$outfile/Table S7 Column 1",clear

gen select=RCP

reghdfe codemission c.belowcl##i.post if select==0,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("City-level COD Emission") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 2",clear

gen select=RCP

reghdfe codemission c.belowcl##i.post if select==0,absorb(i.id i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm-level COD Emission") ///
keep(1.post#c.belowcl) ///
addtext(City FE, NO, Firm FE, YES, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 3",clear

gen select=RCP

reghdfe entrynum c.belowcl##i.post if select==0,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm Entry") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

use "$outfile/Table S7 Column 4",clear

gen select=RCP

reghdfe exitnum c.belowcl##i.post if select==0,absorb(i.city i.province#i.year) cluster(i.province i.year)
outreg2 using "$results/Table S7.xls",append ctitle("Firm Exit") ///
keep(1.post#c.belowcl) ///
addtext(City FE, YES, Firm FE, NO, ProvincebyYear FE, YES) ///
bdec(3) tdec(3) rdec(3)

